minli :: [Int] -> Int
minli [x] = x
minli (x:y:xs) | x<=y = minli (x:xs)
               | otherwise = minli (y:xs)

minl :: [Int] -> Int
minl (x:xs) = foldr min x xs

sumarList :: Num a => a -> [a] -> [a]
sumarList x [] = []
sumarList 0 xs = xs
sumarList x (y:ys) = (x+y) : sumarList x ys

sumarlist :: Num a => a -> [a] -> [a]
sumarlist x xs = map (x+) xs

encabsa :: a -> [[a]] -> [[a]]
encabsa x [] = []
encabsa x (xs:yss) = [x:xs] ++ encabsa x yss

encabs :: a -> [[a]] -> [[a]]
encabs x xss = map (x:) xss

encuentra :: Int -> [(Int,String)] -> String
encuentra x [] = ""
encuentra x ((a,b):ys) | x==a = b
                       | otherwise = encuentra x ys

primIgualesA :: Eq a => a -> [a] -> [a]
primIgualesA b [] = []
primIgualesA b (x:xs) | b==x = x : primIgualesA b xs
		      | otherwise = []

-- py :: Eq a => a -> [a] -> [a]
-- py a xs = foldr f [] xs
--    where f b (x:xs) | a == b = b
--                     | otherwise =

pri :: Eq a => [a] -> [a]
pri (x) = x
pri (x:y:xs)  | x == y = x : pri (x:xs)
              | otherwise = [x]




data Natural = Cero | Sucesor Natural

naturalAInt Cero = 0
naturalAInt (Sucesor nat)= 1 + naturalAInt nat

instance Show Natural
        where
        show nat = show (naturalAInt nat)


instance Eq Natural
        where
        (==) Cero Cero = True
        (==) Cero (Sucesor nat) = False
        (==) (Sucesor nat) Cero = False
        (==) (Sucesor n1) (Sucesor n2) = (n1 == n2)

distintos :: (Eq a, Show a) => a -> a -> String
distintos n1 n2 | n1 == n2 = "Son Iguales"
                | otherwise = "Son diferentes n1 " ++ (show n1) ++ " n2 " ++ (show n2)
